home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / DiskUtil / Misc / BTNTape / tape.rexx < prev    next >
OS/2 REXX Batch file  |  1994-04-03  |  2KB  |  47 lines

  1. /* TAPE.REXX:  Sends useful control commands to tape drive via BTN handler.
  2.      R. Rethemeyer  3/94
  3. */
  4. address command
  5. default_drive = "TAPE"
  6.  
  7. arg cmd drive .
  8. if cmd=""   then signal helpme
  9. if drive="" then drive=default_drive
  10.  
  11. select
  12.    when abbrev("REWIND",cmd,3)    then edata="01"
  13.    when abbrev("RETENSION",cmd,3) then edata="1B 00 00 00 03 00"
  14.    when abbrev("EJECT",cmd,2)     then edata="1B 00 00 00 00 00"
  15.    when abbrev("PREVENT",cmd,4)   then edata="1E 00 00 00 01 00"
  16.    when abbrev("ALLOW",cmd,3)     then edata="1E 00 00 00 00 00"
  17.    when abbrev("END",cmd,3)       then edata="11 03"
  18.    when abbrev("WFM",cmd,3)       then edata="10 00 00 00 01"
  19.    when abbrev("FORWARD",cmd,1)   then edata="11 01 00 00 01"
  20.    when abbrev("BACKWARD",cmd,1)  then do
  21.          'echo >'drive':RAWCMD "11 01 FF FF FE"'  /* 2 steps back */
  22.          edata="11 01 00 00 01"                   /* 1 step forward */
  23.          end
  24.    when abbrev("ERASE",cmd,3)     then do
  25.          say "Are you SURE you want to erase" drive "? (y/n)"
  26.          pull huh .
  27.          if substr(huh,1,1)~="Y" then signal byebye
  28.          'echo >'drive':RAWCMD "01"'  /* rewind first */
  29.          edata="19 01"
  30.          end
  31.    otherwise signal helpme
  32. end
  33.  
  34. 'echo >'drive':RAWCMD "'edata'"'
  35.  
  36. byebye:
  37. exit
  38.  
  39. helpme:
  40.    say "Syntax:   [RX] TAPE <function> [device]"
  41.    say " function is one of:"
  42.    say "   REWind, RETension, EJect, PREVent, ALLow (prevent/allow removal),"
  43.    say "   ERAse, WFM, END (skip to end of data),"
  44.    say "   FORward (skip forward 1 file), BACK (skip back 1 file)."
  45.    say " If omitted, device defaults to" default_drive
  46.    exit
  47.